{% extends "xadmin/base_site.html" %}
{% load xadmin_list i18n %}
{% load xadmin_list xadminmedia %}

{% block extrastyle %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
  <link rel="stylesheet" type="text/css" href="{% xadmin_media_url %}/css/xchangelists.css" />

  {% if cl.formset %}
    <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
    <script type="text/javascript" src="../../jsi18n/"></script>
  {% endif %}
  {{ media }}
  {% if not actions_on_top and not actions_on_bottom %}
    <style>
      #changelist table thead th:first-child {width: inherit}
    </style>
  {% endif %}
{% endblock %}

{% block bodyclass %}change-list{% endblock %}

{% if not is_popup %}
  {% block breadcrumbs %}
    <div class="breadcrumbs">
      <a href="../../">
        {% trans "Home" %}
      </a>
       &rsaquo; 
       <a href="../">
         {{ app_label|capfirst }}
      </a>
      &rsaquo; 
      {{ cl.opts.verbose_name_plural|capfirst }}
    </div>
  {% endblock %}
{% endif %}

{% block coltype %}flex{% endblock %}

{% block content %}
  <div id="content-main">


    {% block object-tools %}              
        <ul class="xobject-tools">
            {% for btn in buttons %}
            <li>            
              {{ btn }}
            </li>
            {% endfor %}                      
          {% if has_add_permission %}
          <li>           
            <a href="add/{% if is_popup %}?_popup=1{% endif %}" class="xbutton ui-state-default ui-corner-all">
                <span class="ui-icon ui-icon-plus"></span>{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}</a>         
          </li>
          {% endif %}
        </ul>
    {% endblock %}


    {% if cl.formset.errors %}
        <p class="errornote">
        {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
        </p>
        <ul class="errorlist">{% for error in cl.formset.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul>
    {% endif %}
    <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
      {% block search %}
	      {% xsearch_form cl search_help_text %}
      {% endblock %}
      {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
      
      {% block filters %}
        {% if cl.has_filters %}
          <div id="changelist-filter">
            <h2>{% trans 'Filter' %}</h2>
            {% for spec in cl.filter_specs %}{% xadmin_list_filter cl spec %}{% endfor %}
          </div>
        {% endif %}
      {% endblock %}
      
      <form action="" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>
      {% if cl.formset %}
        {{ cl.formset.management_form }}
      {% endif %}

      {% block result_list %}
          {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %}
          {% result_list cl %}
          {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}
      {% endblock %}
      {% block pagination %}{% pagination cl %}{% endblock %}
      </form>
    </div>
  </div>
{% endblock %}
